import { IApiControl, IRequestConfig } from '../BaseInterface'
import BaseQuickRequest from '../BaseQuickRequest'
import axios, { AxiosInstance } from 'axios'

/**
 * Axios 请求类
 */
export default class AxiosRequest extends BaseQuickRequest {
    // axios 实例
    request: AxiosInstance;
    constructor(options: IRequestConfig, apiControl: IApiControl) {
        super(options, apiControl)
        this.request = axios.create(this.options);
    }
    /**
     * POST-FORM -> POST-FORMURL
     * @param url 请求地址
     * @param data 请求参数
     * @returns 
     */
    postForm(url: string, data?: any, apiControl?: IApiControl): Promise<any> {
        return this.postFormUrl(url, data, apiControl)
    }
}